package wechat

import (
	"context"
	"hotgo/internal/service"

	"hotgo/api/api/wechat/v1"
)

func (c *ControllerV1) WechatSession(ctx context.Context, req *v1.WechatSessionReq) (res *v1.WechatSessionRes, err error) {
	r, err := service.CommonWechat().JsCode2Session(ctx, req.Code)
	if err != nil {
		return nil, err
	}
	return &v1.WechatSessionRes{
		WechatSessionModel: r,
	}, nil
}
